/**
 * 
 */
package de.cbf.cam.dsa.model.util;

import javax.persistence.Entity;
import javax.persistence.Id;

import de.cbf.cam.dsa.model.persistence.Header;

/**
 * @author Nebelritter
 *
 */
@Entity
public class Position3f extends Header{
	/**
	 * @uml.property  name="x"
	 */
	public float x;
	/**
	 * @uml.property  name="y"
	 */
	public float y;
	/**
	 * @uml.property  name="z"
	 */
	public float z;
	
	
	/**
	 * 
	 */
	public Position3f() {		
	}
	
	public Position3f(float x, float y, float z) {
		super();
		this.x = x;
		this.y = y;
		this.z = z;
	}
	
	public String toString() {
		return "("+x+";"+y+";"+z+")";
	}	
	
	public String desc() {
		return "("+x+","+y+","+z+";"+lenght()+")";
	}
	
	public float lenght(){
		double result=0;		
		double squareSum =Math.pow(x, 2)+Math.pow(y, 2)+Math.pow(z, 2);
		result = Math.sqrt(squareSum);
		return Math.abs((float)result);
	}
	
	public Position3f substract(Position3f other){
		float x =this.x-other.x;
		float y =this.y-other.y;
		float z =this.z-other.z;
		return new Position3f(x, y, z);
	}
	@Override
	@Id
	public String getGuid() {
		return guid;
	}
	@Override
	protected void setGuid(String guid) {
		this.guid =guid;
	}
	/**
	 * @return  the x
	 * @uml.property  name="x"
	 */
	public float getX() {
		return x;
	}
	/**
	 * @return  the y
	 * @uml.property  name="y"
	 */
	public float getY() {
		return y;
	}
	/**
	 * @return  the z
	 * @uml.property  name="z"
	 */
	public float getZ() {
		return z;
	}
	/**
	 * @param x  the x to set
	 * @uml.property  name="x"
	 */
	public void setX(float x) {
		this.x = x;
	}
	/**
	 * @param y  the y to set
	 * @uml.property  name="y"
	 */
	public void setY(float y) {
		this.y = y;
	}
	/**
	 * @param z  the z to set
	 * @uml.property  name="z"
	 */
	public void setZ(float z) {
		this.z = z;
	}

	
}
